﻿Public Class FrmUserPad
    Dim result As DialogResult
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        G_AdminPwd = TextBox1.Text.Trim()
        result = DialogResult.OK
        Me.Close()
    End Sub

    Private Sub FrmUserPad_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        result = DialogResult.None
        G_AdminPwd = ""
        TextBox1.Text = ""
        TextBox1.Focus()
    End Sub

    Private Sub TextBox1_KeyDown(sender As Object, e As KeyEventArgs) Handles TextBox1.KeyDown
        If e.KeyCode = Keys.Enter Then
            G_AdminPwd = TextBox1.Text.Trim()
            result = DialogResult.OK
            Me.Close()
        End If
    End Sub

    Private Sub FrmUserPad_FormClosed(sender As Object, e As FormClosedEventArgs) Handles MyBase.FormClosed
        If result = DialogResult.None Then
            result = DialogResult.Cancel
        End If
        Me.DialogResult = result
    End Sub
End Class